<template>
  <div class="info-table">
    <div class="info-row" v-for="m in mappers" :key="m.key" :style="{width:m.width ? m.width : '100%'}">
      <div class="info-label">{{m.label}}</div>
      <div class="info-value">{{info[m.key]}}</div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "index",
    props: {
      info: {
        type: Object,
        default: () => ({})
      },
      mappers: {
        type: Array,
        default: () => [
          /*{
            label: '字段名称',
            key: '对象key值',
            width:'',// default 100%
          }*/
        ]
      }
    },
    data() {
      return {}
    },
    methods: {},
    mounted() {

    }
  }
</script>

<style lang="scss" scoped>
  .info-table {
    display: flex;
    flex-wrap: wrap;

    .info-row {
      min-height: 39px;
      display: flex;
      border-top: 1px solid rgb(232, 232, 232);

      &:last-child {
        border-bottom: 1px solid rgb(232, 232, 232);
      }

      .info-label {
        width: 160px;
        height: 100%;
        line-height: 39px;
        background-color: #f5f5f5;
        text-align: right;
        padding-right: 8px;
        box-sizing: border-box;
      }

      .info-value {
        height: 100%;
        width: calc(100% - 160px);
        line-height: 39px;
        padding-left: 8px;
        box-sizing: border-box;
      }
    }
  }
</style>
